package ch.uzh.ifi.sopra.gruppe9.game.junit;

import ch.uzh.ifi.sopra.gruppe9.text_pdk.*;

import junit.framework.*;
import java.rmi.RemoteException;
import java.util.ArrayList;

public class TestBoard extends GameBoard {

	private ArrayList<IPlayer> players;

	public TestBoard() throws RemoteException {
		super();
		players = new ArrayList<IPlayer>();
	}
	
	public int registerPlayer() throws RemoteException {
		if(players.size() == 4) {
			return -1;
		}
		if(inGame) {
			return -2;
		}
		int index = players.size();
		IPlayer newPlayer = new Player(this);
		newPlayer.setColor(index);
		newPlayer.setName("Spieler " + (index + 1));
		players.add(newPlayer);
		//Server.getInstance().registerPlayer(index);
		
		return index;
	}
	
	@Override
	public int getPlayerNum() throws RemoteException {
		return players.size();
	}

	public IPlayer getPlayer(int index) throws RemoteException {
		return players.get(index);
	}

	public ArrayList<IPlayer> getPlayers() {
		return players;
	}
}
